package the.broccoli.uc.service.impl;

import org.springframework.util.CollectionUtils;
import the.broccoli.uc.dto.TenantAppCondition;
import the.broccoli.uc.entity.TenantApp;
import the.broccoli.uc.mapper.TenantAppMapper;
import the.broccoli.uc.service.ITenantAppService;
import org.wisteria.framework.web.mvc.service.AbstractSuperService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 租户与应用 服务实现类
 * </p>
 *
 * @author lei.liu
 * @since 2020-04-17
 */
@Service
public class TenantAppServiceImpl extends AbstractSuperService<TenantAppMapper, TenantApp> implements ITenantAppService {

    @Override
    public List<Integer> getAppIdList(Integer tenantId) {
        List<Integer> appIdList = new ArrayList<>();
        TenantAppCondition condition = new TenantAppCondition();
        condition.setTenantId(tenantId);
        List<TenantApp> list = listByCondition(condition);
        if (!CollectionUtils.isEmpty(list)) {
            for (TenantApp e : list) {
                appIdList.add(e.getAppId());
            }
        }
        return appIdList;
    }
}
